package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.QuotesProducts;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class QuotesProductsDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "供应商产品id")
    private Integer productsId;

    @ApiModelProperty(value = "报价id")
    private Integer quotesId;

    @ApiModelProperty(value = "数量")
    private Integer num;

    @ApiModelProperty(value = "总价")
    private Double price;

    @ApiModelProperty(value = "单价")
    private Double onePrice;

    @ApiModelProperty(value = "备注")
    private Double remark;

    @ApiModelProperty(value = "单位名称")
    private String unitName;

    @ApiModelProperty(value = "产品名称")
    private String name;

    @ApiModelProperty(value = "材质")
    private String material;




    public QuotesProductsDTO() {}

    public QuotesProductsDTO(QuotesProducts entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static QuotesProductsDTO convert(QuotesProducts entity) {
        return new QuotesProductsDTO(entity);
    }

    public static List<QuotesProductsDTO> convertList(List<QuotesProducts> list) {
        List<QuotesProductsDTO> resultList = new ArrayList<>();
        for (QuotesProducts entity : list) {
            resultList.add(new QuotesProductsDTO(entity));
        }
        return resultList;
    }}
